package com.ftg.learn.chapter06;

import java.util.Arrays;

/**
 * 引用
 *
 * @author lijiaxin
 * @version 1.0
 * @date 2023/7/12 14:16
 */

public class Arrays01 {

//    https://www.matools.com/api/java8    java类网站

    public static void main(String[] args) {
//        引用类型  Arrays 数组帮助类
        int[] as = {2, 3, 4, 5, 3, 5};
        float[] fs = {3.3f, 4.4f, 6.8f, 1, 3, 5.5f};
        char[] names={'李','张','赵','周','王','阿'};
//        ASCLL码

//        复制
       int[] ints= Arrays.copyOf(as,3);
        System.out.println(Arrays.toString(ints));
//        范围复制
        int[] arr = {1, 2, 3, 4, 5, 6,7};
        int[] a=Arrays.copyOfRange(arr,2,5);
        System.out.println(Arrays.toString(a));

//        填充
        int[] arr1=new int[10];
        Arrays.fill(arr1,15);
        System.out.println(Arrays.toString(arr1));

//        二分查找法
        Arrays.sort(as);
        System.out.println(Arrays.toString(as));
        System.out.println(Arrays.binarySearch(as,5));


//        变成有序的
//        Arrays.sort(as);
        //前三个
        Arrays.sort(as,0,3);
        Arrays.sort(fs);
        Arrays.sort(names);



//        输出tostring
        System.out.println(Arrays.toString(as));
        System.out.println(Arrays.toString(fs));
        System.out.println(Arrays.toString(names));
    }
}
